import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
from sklearn.preprocessing import scale
from sklearn.decomposition import PCA

iris = load_iris()
data = scale(iris.data)
targets = iris.target
pca = PCA(n_components=2)
y = pca.fit_transform(data)

fig, ax = plt.subplots(figsize=(8, 6))
for target in set(targets):
    indices = [i for i, t in enumerate(targets) if t == target]
    subset = y[indices]
    if target == 0:
        ax.scatter(subset[:, 0], subset[:, 1], c='r', marker='o', label='Setosa')
    elif target == 1:
        ax.scatter(subset[:, 0], subset[:, 1], c='g', marker='+', label='Versicolor')
    else:
        ax.scatter(subset[:, 0], subset[:, 1], c='b', marker='x', label='Virginica')

ax.text(3.25, -0.5, 'fist principle', fontsize=10, color='black')
ax.text(-1.75, 3.5, 'second principle', fontsize=10, color='black')
ax.legend(loc='best')
ax.annotate('', xy=(3.9, 0), xytext=(3.8, 0),arrowprops=dict(facecolor='black', shrink=0.1, width=1.25, headwidth=6))
ax.annotate('', xy=(0, 3.9), xytext=(0, 3.8),arrowprops=dict(facecolor='black', shrink=0.1, width=1.25, headwidth=6))
ax.set_xlim(-3.9, 3.9)
ax.set_ylim(-3.9, 3.9)
ax.spines['left'].set_position('zero')
ax.spines['bottom'].set_position('zero')
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
ax.xaxis.set_ticks_position('none')
ax.yaxis.set_ticks_position('none')
plt.show()